Public Partial Class FrmListaSolicitud
    Inherits System.Web.UI.Page
    Private TblClientes As CapaDeNegocios.nCliente = New CapaDeNegocios.nCliente
    Private TblSolicitudes As CapaDeNegocios.nSolicitudServicio = New CapaDeNegocios.nSolicitudServicio
    Dim IdSolicitudInterno As String
    Dim IdClienteInterno As String
    Dim DescripcionSolicitud As String
    Dim numerosolicitud As String

    Protected Sub Page_Load1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Session("Login") = "Anonimo" Then
            Response.Redirect("/")
        End If

        IdSolicitudInterno = Request.QueryString("IdSolicitud")
        IdClienteInterno = Request.QueryString("IdCliente")
        DescripcionSolicitud = Request.QueryString("DescripcionSolicitud")
        numerosolicitud = Request.QueryString("numerosolicitud")
        If Not Page.IsPostBack Then

            llenarCboCliente()
            llenarGVSolicitud()
        End If
    End Sub
    Sub llenarCboCliente()
        CboClientes.DataSource = TblClientes.Listar("", "", "", "", "", "", "", "", "", "", "", "")
        CboClientes.DataTextField = ("RazonSocial")
        CboClientes.DataValueField = ("CodigoCliente")
        CboClientes.DataBind()
    End Sub
    Sub llenarGVSolicitud()
        If CboClientes.SelectedValue <> "" Then
            GVSolicitud.DataSource = TblSolicitudes.BuscarFiltrado(0, (New Date), (New Date), "", CboClientes.SelectedValue, "Pendiente", 0)
            GVSolicitud.DataBind()
        End If

    End Sub

    Protected Sub GVSolicitud_RowDataBound1(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVSolicitud.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            Dim a As LinkButton = e.Row.FindControl("LnkVer")
            Dim b As HiddenField = e.Row.FindControl("HFCodigoSolicitud")
            Dim c As Label = e.Row.FindControl("lblRazonSocial")
            Dim d As Label = e.Row.FindControl("LblDescripcion")

            '  a.OnClientClick = "javascript:window.opener.document.getElementById('" + IdSolicitudInterno + "').value = '" + b.Value.ToString() + "';window.opener.document.getElementById('" + IdClienteInterno + "').value='" + c.Text + "';window.close();"
            a.OnClientClick = "javascript:window.opener.document.getElementById('" + IdSolicitudInterno + "').value = '" + b.Value.ToString() + "';window.opener.document.getElementById('" + IdClienteInterno + "').value='" + c.Text + "';window.opener.document.getElementById('" + DescripcionSolicitud + "').value='" + d.Text + "';window.opener.document.getElementById('" + numerosolicitud + "').value = '" + b.Value.ToString() + "';window.close();"

        End If

    End Sub

    Protected Sub CboClientes_SelectedIndexChanged1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CboClientes.SelectedIndexChanged
        llenarGVSolicitud()
    End Sub
End Class